<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="icon" type="image/x-icon" href="./assert/favicon.svg">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./assert/style.css">
    <title>元旦倒计时</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background: linear-gradient(45deg, #ff7b7b, #ff3d3d);
            color: #fff;
        }

        .countdown {
            text-align: center;
        }

        .countdown h1 {
            font-size: 3rem;
            margin-bottom: 20px;
        }

        .timer {
            font-size: 3rem;
            display: flex;
            gap: 10px;
            justify-content: center;
            font-weight: bold;
        }
        .timer span {
            color: #ff3d3d;
            padding: 10px 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        .timer .digit {
            background: rgb(255, 255, 255);
        }
        .timer .sp {
            color: #ffffff;
            background: #ff3d3d;
            opacity: 0.7;
        }

        .timer div {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .timer label {
            font-size: 1rem;
            margin-top: 5px;
        }
    </style>
</head>
<body>




    <div class="countdown">
        <h1>距离2025元旦还有</h1>
        <div class="timer">
            <!-- <span id="days">00</span>
            <span>:</span> -->
            <span class="digit" id="hours">00</span>
            <span class="sp">:</span>
            <span class="digit" id="minutes">00</span>
            <span class="sp">:</span>
            <span class="digit" id="seconds">00</span>
        </div>
    </div>


<!-- 下雪特效 -->

    <div id="snowflakes"></div>
    <script src="./assert/script.js"></script>

    <script>
        function formatNumber(number) {
            return number.toString().padStart(2, '0');
        }

        function updateCountdown() {
            const now = new Date();
            const nextYear = now.getFullYear() + 1;
            const newYear = new Date(`January 1, ${nextYear} 00:00:00`);
            const diff = newYear - now;

            const days = Math.floor(diff / (1000 * 60 * 60 * 24));
            const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
            const seconds = Math.floor((diff % (1000 * 60)) / 1000);

            // document.getElementById('days').textContent = formatNumber(days);
            document.getElementById('hours').textContent = formatNumber(hours);
            document.getElementById('minutes').textContent = formatNumber(minutes);
            document.getElementById('seconds').textContent = formatNumber(seconds);
        }

        setInterval(updateCountdown, 1000);
        updateCountdown();
    </script>
</body>
</html>
